package com.sunshine.springboot.controller.properties;

import com.sunshine.springboot.dto.properties.My2Properties;
import com.sunshine.springboot.dto.properties.MyProperties;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 自定义属性配置
 *
 * @author WeiHong
 * @date 2018/8/14
 */
@Slf4j
@RestController
@RequestMapping("properties")
public class PropertiesController {

    private MyProperties myProperties;

    private My2Properties my2Properties;

    @Autowired
    public PropertiesController(MyProperties myProperties, My2Properties my2Properties) {
        this.myProperties = myProperties;
        this.my2Properties = my2Properties;
    }

    @RequestMapping("properties")
    public MyProperties properties() {
        log.error("myProperties.toString()：{}", myProperties.toString());
        return myProperties;
    }

    @RequestMapping("properties2")
    public My2Properties properties2() {
        log.info("my2Properties.toString():" + my2Properties.toString());
        return my2Properties;
    }

}
